#ifndef MOVINGUNIT_H
#define MOVINGUNIT_H

#include "unit.h"

class MovingUnit : public Unit
{
public:
    enum Direction {Left, Up, Right, Down};

    MovingUnit();
    MovingUnit(QRect &geometry);

    int getBaseSpeed();
    int getRealSpeed();
    int getDirection();

    void setBaseSpeed(int speed);
    void setRealSpeed(int speed);
    void setDirection(int direction);

    void init();
    void loadPixmaps();
    int getReverseDirection(int d);
    void move(int left, int top);
    void moveUp();
    void moveDown();
    void moveLeft();
    void moveRight();
    void moveTo(int d);
    void truncMove(int left, int top, int right, int bottom);
    void cancelMove();
    void truncCancelMove(int left, int top, int right, int bottom);
    virtual void serializeDebug(QDebug &dbg);
    virtual void serializeIn(QDataStream &in);
    virtual void serializeOut(QDataStream &out);

protected:
    int m_baseSpeed;
    int m_realSpeed;
    int m_direction;
    int m_lastLeft;
    int m_lastTop;
    QString m_leftSprite, m_upSprite, m_rightSprite, m_downSprite;
};

#endif // MOVINGUNIT_H
